package IOStream.CharStream;

import java.io.FileWriter;
import java.io.IOException;

/**
 * ClassName:CharStream006
 * Package:IOStream.CharStream
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/1-22:31
 * @Version:v1.0
 */
public class CharStream006 {
    /**
     * 字符输出流底层原理
     * public void flush() 将缓冲区中的数据,刷新到本地文件中
     * public void close() 释放资源/关流
     * <p>
     * flush刷新：刷新之后,还可以继续往文件中继续写数据
     * close关流：断开通道,无法再往文件中写出数据
     */
    public static void main(String[] args) throws IOException {
        FileWriter fw = new FileWriter("E:\\aaa\\f.txt");

//        for (int i = 0; i < 8193; i++) {
////            fw.write("我爱你");
////            fw.write("你真傻比");
////            fw.write("隔了一堵墙");
////            fw.write("小傻逼");
////            fw.write("菜鸡别狗叫了");
//            fw.write(97);
//        }
        System.out.println("--------------");

        fw.write("我爱你");
        fw.write("你真傻比");

        fw.flush();
//        fw.close();

        fw.write("隔了一堵墙");
        fw.write("小傻逼");
        fw.write("菜鸡别狗叫了");

        fw.close();

    }
}
